<?php


namespace app\common\model;
use think\facade\Db;
use think\facade\Env;
use think\facade\Request;

class Attrg extends Base
{
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    public function ajaxConfigName ($attrg_name, $attrg_id = 0){
        if (empty($attrg_name)) {
            return 1;
        }
        //组装where条件
        $where = array();
        $where[] = array('attrg_name', '=', $attrg_name);
        if ($attrg_id > 0) {
            $where[] = array('attrg_id', '<>', $attrg_id);
        }
        return Db::name('attrg')->where($where)->find();
    }
}